using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using SimpleJson;

namespace Dolls
{
    public class CBuff
    {
        public int index;
        public string name;
        public string nameE;
        public string des;
        public string desE;
        public int type;
        public float atk;
        public float def;
        public float lastT;
        public string modelAssert;
    }

    public class CBuffManager : cDataBase<CBuff,CBuffManager>
    {
        protected override string GetPath()
        {
            return "Assets/project/res/buff.json";
        }

        protected override void ReadData(JsonArray array)
        {
            foreach (JsonObject item in array.Cast<JsonObject>())
            {
                CBuff info = new()
                {
                    index = Convert.ToInt32(item["index"]),
                    name = Convert.ToString(item["name"]),
                    nameE = Convert.ToString(item["nameE"]),
                    des = Convert.ToString(item["des"]),
                    desE = Convert.ToString(item["desE"]),
                    type = Convert.ToInt32(item["type"]),
                    atk = Convert.ToSingle(item["energyAtk"]),
                    def = Convert.ToSingle(item["energyDef"]),
                    lastT = Convert.ToSingle(item["lastT"]),
                    modelAssert = Convert.ToString(item["modleAssetIndex"])
                };
                mDict.Add(info.index, info);
            }

            gameUtility.Log("read buffer.json ok");

        }
       
    }

}


